#include<bits/stdc++.h>
using namespace std;
int n,a[1000005],ans,num,x,cnt;
vector<int> vec;
int main()
{
     freopen("duel.in","r",stdin);
     freopen("duel.out","w",stdout);
     cin>>n;
     for(int i=1;i<=n;i++)
     {
         cin>>a[i];
     }
     for(int i=1;i<=n;i++)
     {
         for(int j=1;j<=n;j++)
         {
             if(a[i]>a[j]&&a[j]!=0)
              {
                  ans++;
                  a[j]=0;
                  break;
              }
         }
         cnt=max(cnt,ans);
     }
     num=n-cnt;
     cout<<num;
     return 0;
}
